import { post } from '@feidao/web/request';

export default async function upload(spaceid: string, file_str: string) {
	const url = 'http://192.168.40.195/fsweb/upload';
	const param = {
		"productid": spaceid,
		"file_string": file_str
	};
	try {
		const res: any = await post(url, param);
		const data = res.responseText as string;
		const data_1 = JSON.parse(data);
		if (data_1 && data_1.length > 0) {
			return data_1[0];
		} else {
			return 'fail';
		}
	} catch (error) {
		const e = error ? error.toString() : "";
	}
}